<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function* test () {
      yield 'a';
      yield 'b';
    }

    function* test1 () {
      yield 'x';
      yield* test();
      yield 'y';
    }
    for (let v of test1()) {
      console.log(v);
    }
    // 要解决这个问题，需要用到 yield* 语句，用来在一个Generator函数中执行另外一个Generator函数。
  </script>
</body>

</html>